/*
 * qiangungun.com Inc.
 * Copyright (c) 2014 All Rights Reserved.
 */package com.qiangungun.xts.common.dal.ibatis;import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;import com.qiangungun.xts.common.dal.daointerface.BusinessMutexTaskDAO;// auto generated importsimport org.springframework.dao.DataAccessException;import java.util.List;import java.util.Map;import java.util.HashMap;import com.qiangungun.xts.common.dal.dataobject.BusinessMutexTaskDO;/** * An ibatis based implementation of dao interface <tt>com.qiangungun.xts.common.dal.daointerface.BusinessMutexTaskDAO</tt>. * * This file is generated by <tt>financenet-dalgen</tt>, a DAL (Data Access Layer)
 * code generation utility specially developed for <tt>iwallet</tt> project.
 * 
 * PLEASE DO NOT MODIFY THIS FILE MANUALLY, or else your modification may
 * be OVERWRITTEN by someone else. To modify the file, you should go to 
 * directory <tt>(project-home)/biz/dal/src/conf/dalgen</tt>, and 
 * find the corresponding configuration file (<tt>tables/business_mutex_task.xml</tt>). 
 * Modify the configuration file according to your needs, then run <tt>financenet-dalgen</tt> 
 * to generate this file.
 *
 */@SuppressWarnings({"unchecked","deprecation"})public class IbatisBusinessMutexTaskDAO extends SqlMapClientDaoSupport implements BusinessMutexTaskDAO {	/**
	 *  Update DB table <tt>business_mutex_task</tt>.
	 *
	 *  <p>
	 *  The sql statement for this operation is <br>
	 *  <tt>update business_mutex_task set lock_status='L', lock_host=? where (task_name = ?)</tt>
	 *
	 *	@param lockHost
	 *	@param taskName
	 *	@return int
	 *	@throws DataAccessException
	 */	 
    public int lockTask(String lockHost, String taskName) throws DataAccessException {
        Map<String,Object> param = new HashMap<String,Object>();

        param.put("lockHost", lockHost);
        param.put("taskName", taskName);

        return getSqlMapClientTemplate().update("MS-BUSINESS-MUTEX-TASK-LOCK-TASK", param);
    }		/**
	 *  Update DB table <tt>business_mutex_task</tt>.
	 *
	 *  <p>
	 *  The sql statement for this operation is <br>
	 *  <tt>update business_mutex_task set lock_status='U' where ((task_name = ?) AND (lock_host = ?))</tt>
	 *
	 *	@param taskName
	 *	@param lockHost
	 *	@return int
	 *	@throws DataAccessException
	 */	 
    public int unLockTask(String taskName, String lockHost) throws DataAccessException {
        Map<String,Object> param = new HashMap<String,Object>();

        param.put("taskName", taskName);
        param.put("lockHost", lockHost);

        return getSqlMapClientTemplate().update("MS-BUSINESS-MUTEX-TASK-UN-LOCK-TASK", param);
    }		/**
	 *  Query DB table <tt>business_mutex_task</tt> for records.
	 *
	 *  <p>
	 *  The sql statement for this operation is <br>
	 *  <tt>select id, task_name, lock_host, lock_status, collect_span, expire_time, cron_expression, gmt_last_lock, cron_expression from business_mutex_task</tt>
	 *
	 *	@return List<BusinessMutexTaskDO>
	 *	@throws DataAccessException
	 */	 
    public List<BusinessMutexTaskDO> getAllTask() throws DataAccessException {

        return getSqlMapClientTemplate().queryForList("MS-BUSINESS-MUTEX-TASK-GET-ALL-TASK", null);

    }	}	